"""
不需要手动调用fs.close（）    -关闭文件
自动帮忙关闭文件

"""

with open(r"C:\Users\Mr MING\PycharmProjects\pythonProject1-编辑测试\day8\写入",mode="a",encoding="utf-8") as fs:
    fs.write("Y\n")
    fs.write("小样\n")

with open(r"C:\Users\Mr MING\PycharmProjects\pythonProject1-编辑测试\day8\写入",encoding="utf-8") as fs:
    data = fs.read()
    print(data)